﻿using BCCommon;
using BCCommon.Enums;
using BCCommon.FreightEnums;
using BCCommon.PaymentEnums;
using BCDto.Common.FlowRecord;
using BCDto.Common.Wallet;
using BCDto.Website.User;
using System;

namespace BCService.Common.Wallet
{
    /// <summary>
    /// 钱包服务
    /// </summary>
    public interface IWalletService
    {
        /// <summary>
        /// 获取钱包信息
        /// </summary>
        /// <param name="userId">用户Id</param>
        /// <param name="showPassword">显示密码</param>
        /// <returns></returns>
        WalletDto GetWalletByUserId(long userId, bool showPassword = false);
        /// <summary>
        /// 更新钱包
        /// </summary>
        /// <param name="entity">钱包信息</param>
        /// <returns></returns>
        WalletDto Update(WalletDto entity);
        /// <summary>
        /// 获取流水记录分页信息
        /// </summary>
        /// <param name="userId">用户Id</param>
        /// <param name="orderNo">订单编号</param>
        /// <param name="flowType">流水类型</param>
        /// <param name="flowDirection">资金流向</param>
        /// <param name="payChannel">支付渠道</param>
        /// <param name="start">开始时间</param>
        /// <param name="end">结束时间</param>
        /// <param name="ascending">升序排序</param>
        /// <param name="pageIndex">当前页码</param>
        /// <param name="pageSize">每页数据条数</param>
        /// <returns></returns>
        PageableList<UserFlowRecordDto> GetCurrentDirverWalletDetails(long? userId, string orderNo, FlowType? flowType, SourceFlowDirectionType? flowDirection, PaymentChannelType? payChannel, DateTime? start, DateTime? end, bool? ascending, int pageIndex, int pageSize);   


        /// <summary>
        /// 查看指定用户的账单明细
        /// </summary>
        /// <param name="userId">用户编号</param>
        /// <param name="ascending">升序排序</param>
        /// <param name="pageIndex">分页页码</param>
        /// <param name="pageSize">分页页数</param>
        /// <returns></returns>
        PageableList<UserFlowRecordDto> GetFlowDetails(long? userId, bool? ascending, int pageIndex, int pageSize);



        /// <summary>
        /// 首次设置支付密码
        /// </summary>
        /// <param name="user">登录用户信息</param>
        /// <param name="walletRequestDto">钱包请求信息</param>
        /// <returns></returns>
        WalletDto FirstSetPayPassword(UserDto user, WalletRequestDto walletRequestDto);
        /// <summary>
        /// 重置支付密码
        /// </summary>
        /// <param name="phone">手机号</param>
        /// <param name="userId">用户Id</param>
        /// <param name="walletResetRequestDto">新支付密码</param>
        /// <returns></returns>
        WalletDto ResetPayPassword(string phone, long userId, WalletResetRequestDto walletResetRequestDto);
        /// <summary>
        /// 修改支付密码
        /// </summary>
        /// <param name="dto">用户信息</param>
        /// <param name="walletResetRequestDto">新支付密码</param>
        /// <returns></returns>
        WalletDto ChangePaypassword(UserDto dto, WalletResetRequestDto walletResetRequestDto);
        /// <summary>
        /// 余额充值
        /// </summary>
        /// <param name="current">当前用户</param>
        /// <param name="rechargeAmount">充值金额</param>
        /// <param name="rechargeNo">充值编号</param>
        /// <param name="payChannelType">支付渠道</param>
        /// <returns></returns>
        WalletDto BalanceRecharge(UserDto current, decimal rechargeAmount, string rechargeNo, PaymentChannelType payChannelType);
        /// <summary>
        /// 修改阿里支付授权信息
        /// </summary>
        /// <param name="userId">用户Id</param>
        /// <param name="payAuthInfo">支付授权信息</param>
        /// <returns></returns>
        int ChangeAliPayAuthInfo(long userId, string payAuthInfo);
        /// <summary>
        /// 修改微信支付授权信息
        /// </summary>
        /// <param name="userId">用户Id</param>
        /// <param name="payAuthInfo">支付授权信息</param>
        /// <returns></returns>
        int ChangeWxPayAuthInfo(long userId, string payAuthInfo);
        /// <summary>
        /// 修改密码错误次数
        /// </summary>
        /// <param name="userId">用户Id</param>
        /// <param name="passwordErrorCount">密码错误次数</param>
        /// <returns></returns>
        WalletDto UpdatePasswordErrorCount(long userId, int passwordErrorCount);
        /// <summary>
        /// 清理密码错误次数--自动任务使用
        /// </summary>
        /// <returns></returns>
        void ClearErrorCount();
        
        ///// <summary>
        ///// 查看指定司机的账单明细
        ///// </summary>
        ///// <param name="driverId">司机ID</param>
        ///// <param name="start">开始时间</param>
        ///// <param name="end">结束时间</param>
        ///// <param name="ascending">排序</param>
        ///// <param name="index">页号</param>
        ///// <param name="size">每页数据条数</param>
        ///// <returns></returns>
        //PageableList<UserFlowRecordDto> UserFlowRecord(long driverId, DateTime? start, DateTime? end, bool? ascending, int index, int size);

        ///// <summary>
        ///// 获取指定司机钱包信息
        ///// </summary>
        ///// <param name="driverId">司机信息</param>
        ///// <returns></returns>
        //WalletDto GetWalletByDriverId(long driverId);
    }
}
